<template>
  <div id="edit">
    <el-row class="edit-title">
      <el-col :span="4">新增医嘱</el-col>
      <el-col :span="3" :push="17" class="text-right">
        <el-button
          class="back"
          type="info"
          size="mini"
          plain
          icon="el-icon-arrow-left"
          @click="goBack"
        >返回</el-button>
      </el-col>
    </el-row>
    <el-form :model="info" :rules="rules" ref="info" label-width="100px" class="el_t_20">
      <el-form-item label="医嘱名称：" prop="name">
        <el-row>
          <el-col :span="8">
            <el-input v-model="info.name" placeholder="请输入医嘱名称"></el-input>
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="所属分类：" prop="name">
        <el-row>
          <el-col :span="8">
            <el-select v-model="info.radio" placeholder="请选择所属分类" class="el_long">
              <el-option label="请选择所属分类" :value="1"></el-option>
            </el-select>
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="医嘱内容：" prop="name">
        <el-row>
          <el-col :span="24">
            <el-input type="textarea" v-model="info.name" :rows="3" placeholder="请输入医嘱内容"></el-input>
          </el-col>
        </el-row>
      </el-form-item>
    </el-form>
    <el-row class="footer-fixed">
      <el-col :span="24" class="text-right">
        <el-button type="primary" plain>取 消</el-button>
        <el-button type="primary" @click="submitInfo('info')">保 存</el-button>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  name: "edit",
  data() {
    return {
      info: {
        name: "",
        radio: 1
      },
      rules: {
        name: [
          { required: true, message: "医嘱名称不能为空", trigger: "blur" }
        ],
        radio: [
          { required: true, message: "请选择所属分类", trigger: "change" }
        ]
      }
    };
  },
  methods: {
    submitInfo(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("验证通过！");
        } else {
          return false;
        }
      });
    },
    goBack() {
      this.$router.go(-1);
    }
  }
};
</script>
<style scoped>
#edit {
  width: 100%;
  height: calc(100vh - 108px);
  background: #ffffff;
  padding: 20px;
}
.edit-title {
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e4e4;
  color: #006835;
  font-weight: 700;
}
</style>


